	YAHOO.MANAGERSHEET.holidays.dwr.showMessage =  function (message) 
	{
		alert(message);
	}	
	
	YAHOO.MANAGERSHEET.holidays.bindCalendar =  false;

	YAHOO.MANAGERSHEET.holidays.calendar.init = function() { 
		YAHOO.MANAGERSHEET.holidays.calendar.cal1 = 
			new YAHOO.widget.Calendar("cal1","yahooHolidayCalendar", { MULTI_SELECT: true } ); 


	} 
	
	YAHOO.MANAGERSHEET.holidays.calendar.selectDate = function(type,args,obj)
	{
		if ( YAHOO.MANAGERSHEET.holidays.bindCalendar )
		{
			var date = args[0];  
	
			date = date.toString();
			date = date.replace(/,/g, "/");
			arrDate = date.split("/");
			date = arrDate[2] + "/" + arrDate[1]+ "/" + arrDate[0];
	
			JDwrHelper.addHoliday(date, YAHOO.MANAGERSHEET.holidays.dwr.showMessage);
		}
	}
	
	YAHOO.MANAGERSHEET.holidays.calendar.unSelectDate = function(type,args,obj)
	{
		var date = args[0];  

		date = date.toString();
		date = date.replace(/,/g, "/");
		arrDate = date.split("/");
		date = arrDate[2] + "/" + arrDate[1]+ "/" + arrDate[0];
	
		JDwrHelper.removeHoliday(date, YAHOO.MANAGERSHEET.holidays.dwr.showMessage)
	}
	
	function selectHolidays()
	{
		var arrStrDates = strDates.split(",");

		for	(i =0 ; i< arrStrDates.length; i++)
		{
			if ( arrStrDates[i] != "" )
			{
				YAHOO.MANAGERSHEET.holidays.calendar.cal1.select(formatDate(arrStrDates[i]));
			}
				
		}
		
	}	
	
	function formatDate(strDate)
	{
		var oDate = new Date(strDate);
		var strDay = oDate.getDate();
		var strMonth = oDate.getMonth() + 1;
		var strYear = oDate.getFullYear();
		var strDate = strMonth + "/" + strDay + "/" + strYear;	
		return strDate;
	}

	function initCalendar()
	{
		YAHOO.MANAGERSHEET.holidays.calendar.init(); 
		YAHOO.MANAGERSHEET.holidays.calendar.cal1.selectEvent.subscribe
		(
			YAHOO.MANAGERSHEET.holidays.calendar.selectDate, 
			YAHOO.MANAGERSHEET.holidays.calendar.cal1, 
			true
		);
		
		YAHOO.MANAGERSHEET.holidays.calendar.cal1.deselectEvent.subscribe
		(
			YAHOO.MANAGERSHEET.holidays.calendar.unSelectDate, 
			YAHOO.MANAGERSHEET.holidays.calendar.cal1, 
			true
		);		

		
		
		YAHOO.MANAGERSHEET.holidays.calendar.cal1.render(); 
		
		selectHolidays();
		
		YAHOO.MANAGERSHEET.holidays.calendar.cal1.render(); 
		
		YAHOO.MANAGERSHEET.holidays.bindCalendar = true;

	
	}

 	YAHOO.util.Event.onAvailable("yahooHolidayCalendar", initCalendar);